#ifndef QQ_LOG
#define QQ_LOG

#include <qdatetime.h>

#include <spdlog/async.h>
#include <spdlog/sinks/basic_file_sink.h>
#include <spdlog/sinks/rotating_file_sink.h>
#include <spdlog/sinks/stdout_color_sinks.h>
#include <spdlog/spdlog.h>

#include "api/QQOpenSSLApi.h"
#include "api/QQZipApi.h"

#include "core/QQSettings.h"

#define qq_log QQLog::getInstance()

class QQLog : public QObject
{
	Q_DISABLE_COPY_MOVE(QQLog)
private:
	QQLog(QObject* parent = nullptr);
public:
	static QQLog* getInstance();
	void init();
	void destroy();
private:
	static void ubMessageOutput(QtMsgType type, const QMessageLogContext& context, const QString& msg);
	static void handleDebug(const QString& msg);
	static void handleInfo(const QString& msg);
	static void handleWarn(const QString& msg);
	static void handleError(const QString& msg);
	static void handleCritical(const QString& msg);

	bool containsSensitiveData(const QString& msg);
	void checkAndHandleCompress();
};

#endif // QQ_LOG